/**
 * 
 */
package de.tuhh.simsearch.model.persistence.contentmgmt.files.interfaces;

import java.io.IOException;
import java.io.InputStream;

import de.tuhh.simsearch.model.persistence.contentmgmt.entities.FileEntity;

/**
 * The FileAccessInterface should be used to save, remove and get files from the file system.
 * 
 * @author SimSearch 1
 */
public interface FileAccessInterface {

  /**
   * Gets a file given a file entity
   * 
   * @param entity
   *          the file entity containing name and path
   * @return the InputStream to download the file
   * @throws IOException
   */
  public InputStream getFile(FileEntity entity) throws IOException;

  /**
   * Saves a file on the filesystem. The path where the file should be stores is contained in the file entity.
   * 
   * @param fileStream
   *          The input stream to store the file
   * @param entity
   *          the file entity containing name and path
   * @return true if successful, false otherwise
   * @throws IOException
   */
  boolean saveFile(InputStream fileStream, FileEntity entity) throws IOException;

  /**
   * Removes a file on the filesystem.
   * 
   * @param entity
   *          the file system containing the file name and path
   * @return true if successful, false otherwise
   */
  public boolean removeFile(FileEntity entity);

}
